<template>
  <div class="world">
    <head-nav></head-nav>
    <div class="contentBox">
      <user-info :user="user"></user-info>
      <order-state></order-state>
      <module-info></module-info>
      <recom-ele></recom-ele>
      <div class="randBox">
        <rand-rec></rand-rec>
      </div>
      <botton-ele></botton-ele>
    </div>
  </div>
</template>

<script>
// 底部导航组件
import bottonEle from "../components/common/botton.vue";
// 顶部标题
import headNav from "../components/common/headTitle.vue";
// 用户卡片
import userInfo from "../components/myHome/userInfo.vue";
// 订单状态
import orderState from "../components/myHome/order.vue";
// 模板一
import moduleInfo from "../components/myHome/module_1.vue";
// 为你推荐
import recomEle from "../components/myHome/recom.vue";
// 随机推荐
import randRec from "../components/common/randRec.vue";

export default {
  data() {
    return {
      title: "我的知心Go",
      active: 3,
      user: "",
    };
  },
  components: {
    headNav,
    userInfo,
    orderState,
    moduleInfo,
    recomEle,
    randRec,
    bottonEle,
  },
  created() {
    // 请求用户信息
    let info = {
      type: "get",
      url: "/user/info",
    };
    this.$netWork(info).then((res) => {
      if (res.data.status === 0) {
        this.user = res.data.data;
        let userImg = sessionStorage.getItem("userImg");
        if (userImg) {
          this.user.userImg = userImg;
        }
      }
    });
  },
};
</script>

<style lang="scss" scoped>
.world {
  width: 100%;
  height: 100%;
  background-color: #f7f7f7;
  .contentBox {
    padding-top: 48px;
  }

  .randBox {
    margin-top: 16px;
  }
}
</style>
